﻿using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;

namespace suirui.ZhuMu.Log
{
    /// <summary>
    /// 日志扩展
    /// </summary>
    public static partial class ServiceExtension
    {
        /// <summary>
        /// 注册NLog日志操作
        /// </summary>
        /// <param name="services">服务集合</param>
        /// <param name="name">服务名称</param>
        public static void AddLog4Net(this IServiceCollection services,string configPath = null)
        {
            if (string.IsNullOrEmpty(configPath))
            {
                configPath = Path.Combine(AppContext.BaseDirectory, "Log4net.config");            }

            Log4netLoger.Init(configPath);

        }
    }
}
